
#最小cmake版本
cmake_minimum_required(VERSION 3.10)

#项目名
project(zyChart LANGUAGES CXX)

set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
#生成编译信息
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

include_directories(./sources)

#查找所有头文件
file(GLOB_RECURSE incs 
        "sources/global.h"
        "sources/mainwindow.h"
        "sources/logindialog.h"
        "sources/registerdialog.h"
        "sources/singleton.h"
        "sources/httpmgr.h"
    )

#查找所有源文件
file(GLOB_RECURSE srcs 
        "sources/main.cpp"
        "sources/global.cpp"
        "sources/mainwindow.cpp"
        "sources/logindialog.cpp"
        "sources/registerdialog.cpp"
        "sources/httpmgr.cpp"
    )

#查找所有资源文件
file(GLOB_RECURSE ress 
        "*.qrc"
        "*.rc"
    )

add_executable(${PROJECT_NAME}
        ${incs}
        ${srcs}
        ${ress}
    )

find_package(Qt5 COMPONENTS Core Widgets Network REQUIRED)

target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Core Qt5::Widgets Qt5::Network)

set_target_properties(${PROJECT_NAME} PROPERTIES
        WIN32_EXECUTABLE OFF
    )
